#ifndef IMUTEX_H
#define IMUTEX_H

#ifdef WIN32
//#include <winsock2.h>
#include <windows.h>
#else
#include <pthread.h>
#endif

#define ERR_IMUTEX_ALREADYINIT		-1
#define ERR_IMUTEX_NOTINIT			-2
#define ERR_IMUTEX_CANTCREATEMUTEX	-3

class IMutex
{
public:
	IMutex();
	~IMutex();
	int Init();
	int Lock();
	int Unlock();
	bool IsInitialized() { return initialized; }

private:
#ifdef WIN32
	HANDLE mutex;
#else
	pthread_mutex_t mutex;
#endif
	bool initialized;
};

#endif
